
String.prototype.Trim = function() {  
  var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);  
  return (m == null) ? "" : m[1];  
}

String.prototype.isMobile = function() {  
  return (/^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})$/.test(this.Trim()));  
} 

String.prototype.isTel = function()
{
    
    //return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
    return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
}

function chkForm() { 
	
    with(document.meet_form){
    	
    	if (username.value == "")
        {
          alert("用户名不能为空!");
          username.focus();
          return false;
        }
    	
    	//alert(age_value);
    	
        if (tel.value.isMobile()||tel.value.isTel())  {  
            tel.value = tel.value.Trim();  
            
            return true;  
        } 
        else {  
            alert("你输入的电话号码格式有误"); 
            tel.focus();
            return false;        
        }
     
    }
    return true;
}  
